﻿using GeneralServices.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApplication1.TestComposantV2
{
    public class FactoryDTOEmballage : AbstractFactoryDTO
    {
        #region AbstractFactoryDTO Membres

        public override IDTO CreateDTO(object o)
        {
            if (o is EMB_EMBALLAGE)
            {
                DTOEmballage emb = new DTOEmballage();
                emb.ATELIER = (o as EMB_EMBALLAGE).ATELIER;
                emb.CODE_EMBALLAGE = (o as EMB_EMBALLAGE).CODE_EMBALLAGE;
                emb.ATELIER = (o as EMB_EMBALLAGE).ATELIER;
                emb.TOP_ACTIF = (o as EMB_EMBALLAGE).TOP_ACTIF;
                emb.TOP_EMBA_AVEC_HAUTEUR = (o as EMB_EMBALLAGE).TOP_EMBA_AVEC_HAUTEUR;
                emb.TOP_COUVERCLE = (o as EMB_EMBALLAGE).TOP_COUVERCLE;
                emb.FLUX_UTILISATION = (o as EMB_EMBALLAGE).FLUX_UTILISATION;
                emb.CODE_PLAN = (o as EMB_EMBALLAGE).CODE_PLAN;
                emb.OBSERVATION = (o as EMB_EMBALLAGE).OBSERVATION;
                emb.MARCHE = (o as EMB_EMBALLAGE).MARCHE;
                emb.IMAGE_EMBALLAGE = (o as EMB_EMBALLAGE).IMAGE_EMBALLAGE;
                emb.DATE_HEURE_CREATION = (o as EMB_EMBALLAGE).DATE_HEURE_CREATION;
                emb.DATE_HEURE_MODIF = (o as EMB_EMBALLAGE).DATE_HEURE_MODIF;
                emb.RESP_MISE_A_JOUR = (o as EMB_EMBALLAGE).RESP_MISE_A_JOUR;
                return emb;
            }
            else
                return null;
        }

        public override object CreateBean(IDTO dto)
        {
            if (dto is DTOEmballage)
            {
                EMB_EMBALLAGE emb = new EMB_EMBALLAGE();
                emb.ATELIER = (dto as DTOEmballage).ATELIER;
                emb.CODE_EMBALLAGE = (dto as DTOEmballage).CODE_EMBALLAGE;
                emb.ATELIER = (dto as DTOEmballage).ATELIER;
                emb.TOP_ACTIF = (dto as DTOEmballage).TOP_ACTIF;
                emb.TOP_EMBA_AVEC_HAUTEUR = (dto as DTOEmballage).TOP_EMBA_AVEC_HAUTEUR;
                emb.TOP_COUVERCLE = (dto as DTOEmballage).TOP_COUVERCLE;
                emb.FLUX_UTILISATION = (dto as DTOEmballage).FLUX_UTILISATION;
                emb.CODE_PLAN = (dto as DTOEmballage).CODE_PLAN;
                emb.OBSERVATION = (dto as DTOEmballage).OBSERVATION;
                emb.MARCHE = (dto as DTOEmballage).MARCHE;
                emb.IMAGE_EMBALLAGE = (dto as DTOEmballage).IMAGE_EMBALLAGE;
                emb.DATE_HEURE_CREATION = (dto as DTOEmballage).DATE_HEURE_CREATION;
                emb.DATE_HEURE_MODIF = (dto as DTOEmballage).DATE_HEURE_MODIF;
                emb.RESP_MISE_A_JOUR = (dto as DTOEmballage).RESP_MISE_A_JOUR;
                return emb;
            }
            else
                return null;
        }
    
        #endregion
    }
}
